package com.newbingo.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.newbingo.dao.imple.IBettingItemDao;
import com.newbingo.dto.imple.IBettingItemDto;
import com.newbingo.entity.BettingItem;
import com.newbingo.util.Pager;

public class BettingItemDto implements IBettingItemDto,Serializable {

	private String periodNum; // 期号
	private String betTime;// 投注时间
	private String orderNum;// 订单号
	private String orderContent;// 内容
	private Integer betMoney;// 投注金额
	private Integer betResult;// 投注结果(输赢情况)
	private Integer memberId;

	private IBettingItemDao bettingItemDao = null;

	public Pager findByMemberId(int start, int limit, int memberId, String gameName,
			Date startTime, Date endTime) {
		Pager page = bettingItemDao.findByMemeberId(start, limit, memberId,
				gameName, startTime, endTime);
		List<BettingItem> bettingItem = page.getData();
		System.out.println("Dto中List的大小："+bettingItem.size());
		Pager pager = new Pager();
		pager.setTotalSize(page.getTotalSize());
		List<BettingItemDto> bettingItemDto = new ArrayList<BettingItemDto>();
		BettingItemDto itemDto = null;
		for (BettingItem betting : bettingItem) {
			itemDto = new BettingItemDto();
			itemDto.setPeriodNum(betting.getPeriodGame().getPgnum()+"");
			itemDto.setBetTime(betting.getBetTime()+"");
			itemDto.setOrderNum(betting.getItemid()+"");
			itemDto.setOrderContent(betting.getBettingCell().getGamePlay()
					.getGame().getGamename()
					+ " "
					+ betting.getPeriodGame().getPgnum()
					+ "期"
					+ " "
					+ "("
					+ betting.getBettingCell().getName() + ")");
			itemDto.setBetMoney(betting.getAmount());
			itemDto.setBetResult(betting.getBetResult());
			itemDto.setMemberId(betting.getMember().getUno());
			bettingItemDto.add(itemDto);
		}
		pager.setData(bettingItemDto);
		return pager;
	}

	public String getPeriodNum() {
		return periodNum;
	}

	public void setPeriodNum(String periodNum) {
		this.periodNum = periodNum;
	}

	public String getBetTime() {
		return betTime;
	}

	public void setBetTime(String betTime) {
		this.betTime = betTime;
	}

	public String getOrderNum() {
		return orderNum;
	}

	public void setOrderNum(String orderNum) {
		this.orderNum = orderNum;
	}

	public String getOrderContent() {
		return orderContent;
	}

	public void setOrderContent(String orderContent) {
		this.orderContent = orderContent;
	}

	public Integer getBetMoney() {
		return betMoney;
	}

	public void setBetMoney(Integer betMoney) {
		this.betMoney = betMoney;
	}

	public Integer getBetResult() {
		return betResult;
	}

	public void setBetResult(Integer betResult) {
		this.betResult = betResult;
	}

	public IBettingItemDao getBettingItemDao() {
		return bettingItemDao;
	}

	public void setBettingItemDao(IBettingItemDao bettingItemDao) {
		this.bettingItemDao = bettingItemDao;
	}

	public Integer getMemberId() {
		return memberId;
	}

	public void setMemberId(Integer memberId) {
		this.memberId = memberId;
	}

}
